<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>
<title>binop/lit8</title>
<link rel=stylesheet href="opcode.css">
</head>

<body>

<h1>binop/lit8</h1>

<h2>Purpose</h2>

<p>
Perform the indicated binary op on the indicated register (first argument) and
literal value (second argument), storing the result in the destination register.
</p>

<h2>Details</h2>

<table class="instruc">
<thead>
<tr>
  <th>Op &amp; Format</th>
  <th>Mnemonic / Syntax</th>
  <th>Arguments</th>
</tr>
</thead>
<tbody>
<tr>
  <td>d8..e2 22b</td>
  <td><i>binop</i>/lit8 vAA, vBB, #+CC<br/>
    d8: add-int/lit8<br/>
    d9: rsub-int/lit8<br/>
    da: mul-int/lit8<br/>
    db: div-int/lit8<br/>
    dc: rem-int/lit8<br/>
    dd: and-int/lit8<br/>
    de: or-int/lit8<br/>
    df: xor-int/lit8<br/>
    e0: shl-int/lit8<br/>
    e1: shr-int/lit8<br/>
    e2: ushr-int/lit8
  </td>
  <td><code>A:</code> destination register (8 bits)<br/>
    <code>B:</code> source register (8 bits)<br/>
    <code>C:</code> signed int constant (8 bits)</td>
</tr>
</tbody>
</table>

<h2>Constraints</h2>

<ul>
  <li>
    Both A and B must be valid register indices in the current stackframe.
  </li>
  <li>
    Registers vA and vB must be defined. They must both contain integer values.
  </li>
  <li>
    C is an immediate, signed integer constant taken from the instruction stream
    (actually this means there are no special requirements for C at all).
  </li>
</ul>

<h2>Behavior</h2>

<ul>
  <li>
    The given operation &lt;binop&gt; is performed according to the semantics
    specified in table XXX.
  </li>
  <li>
    Argument C is sign-extended to 32 bits before.
  </li>
  <li>
    The result is stored in register vA, that is, vA'=vB &lt;binop&gt; vC.
  </li>
  <li>
    As usual, neighboring registers might get undefined, if vA was part of a
    register pair originally.
  </li>
</ul>

<h2>Exceptions</h2>

<ul>
  <li>
    ArithmeticException if an error occurs during the instruction.
  </li>
</ul>

</body>
</html>
